<#include "common/common.html"/>
<meta charset="UTF-8">
<script type="text/javascript">
function formatStatus(value,row,index){
	if(value==0){
		return "未处理";
	}else{
		return "已处理";
	}
}

function multiHandle(actUrl){
	var rows = $('#datagrid').datagrid('getSelections');
	if (rows.length>0){
		var ids = [];
    	for(var i=0; i<rows.length; i++){
    		ids.push(rows[i].id);
    	}
    	url = $("#base").val()+"/"+actUrl;
         $.messager.confirm('处理留言','确定要处理当前留言信息吗？',function(r){
            if (r){
                $.post(url,{ids:ids.join(',')},function(result){
                	var result = eval('('+result+')');
                	if (result.errorMsg){
                 	   $.messager.alert('错误',result.errorMsg,'error');
                    } else if(result.infoMsg){
                 	   $.messager.alert('提示',result.infoMsg,'info');
                    }else{
                       $('#datagrid').datagrid('reload');   
                    }
                });
            }
        });
    }else{
    	$.messager.alert('提示','请选择至少一条数据进行操作','info');
    }
   }
   
function query(formId) {
	var serializeObj = {};
	var array = $('#' + formId).serializeArray();
	$(array).each(
			function() {
				if (serializeObj[this.name]) {
					if ($.isArray(serializeObj[this.name])) {
						serializeObj[this.name].push(this.value);
					} else {
						serializeObj[this.name] = [serializeObj[this.name], this.value ];
					}
				} else {
					serializeObj[this.name] = this.value;
				}
			});
	queryData(serializeObj);
}
function tip(data){
    $(this).datagrid('doCellTip', {'max-width': '400px', 'delay': 500 });
}
</script>
<script type="text/javascript" src="${static}/js/easyui_extend_datagridTip.js?v=${bv}"></script>
<table
	     class="easyui-datagrid"   
	     id="datagrid"  
         title="意向留言"  
         url="${base}/intentionMessage/list"
         toolbar="#searchtool,#toolbar" 
         pagination="true"
         rownumbers="true" 
         data-options="fit:false,border:false,pageSize:20,onLoadSuccess:tip" > 
    <thead>  
        <tr>
            <th field="id" checkbox="true" width="5%"></th>  
            <th field="intro" align="center" width="15%">标题</th>
            <th field="umobile" align="center" width="7%">手机号</th>
            <th field="userName" align="center" width="6%">发布人</th>
            <th field="status" align="center" formatter="formatStatus" width="5%">留言状态</th>     
            <th field="createTime" align="center" width="10%">发布时间</th>
            <th field="content" align="center" width="17%">内容</th> 
            <th field="handlePerson" align="center" width="6%">操作员</th>  
            <th field="handleTime" align="center" width="10%">操作时间</th>  
            <th field="note" align="center" width="19%">备注</th>
        </tr>  
    </thead>  
</table>  
<div id="searchtool" style="padding:5px">
    <form id="searchForm" method="post">
	<span>留言状态:</span>
	<select id="status" class="easyui-combobox" name="status" style="width:200px;">   
	    <option value="">全部</option>   
	    <option value="1">已处理</option>   
	    <option value="0">未处理</option>   
	</select> 
	<span>关键字:</span>
	<input type="text" id="keyWord" name="keyWord" data-options="prompt:'标题/手机号/姓名'" class="easyui-textbox" size=20 />  
	<span>起始时间:</span>
	<input id="startDate" name="startDate" type="text" class="easyui-datebox" />
	<span>截止时间:</span>
	<input id="endDate" name="endDate" type="text" class="easyui-datebox" />
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" onclick="javascript:query('searchForm');">搜索</a>
    </form>  
<div>  
<div id="toolbar">
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="javascript:multiHandle('intentionMessage/multiHandle');">已处理</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="javascript:openEditDlg('添加备注','intentionMessage/edit','intentionMessage-dlg','intentionMessage-fm');">编辑</a>
</div>

	<!--编辑弹框开始-->
		<div id="intentionMessage-dlg" class="easyui-dialog" title="添加备注" style="padding: 10px;" data-options="iconCls: 'icon-save',closed: true,modal:true,buttons:'#intentionMessage-dlg-buttons'" >
			<form id="intentionMessage-fm" method="post">
				<div>
					<p>
						<label>备注：</label> <input name="note" class="easyui-textbox" data-options="height:70,width:200,multiline:true,required: true,validType:'maxLength[200]'" type="text" />
					</p>
				</div>
			</form>
		</div>
		<div id="intentionMessage-dlg-buttons">
		    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="javascript:submit('intentionMessage-dlg','intentionMessage-fm');" style="width:90px">提交</a>
		    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#intentionMessage-dlg').dialog('close');" style="width:90px">取消</a>
		</div>		
	<!--编辑弹框结束-->
   